package work.jame.blog.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import work.jame.blog.framework.VerificationGroup;

import javax.validation.constraints.Null;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author Jame
 * @since 2023-05-14
 */
@TableName("user_message")
public class UserMessage implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 发送消息者用户id
     */
    @TableField("send_user_id")
    private Long sendUserId;

    /**
     * 接收消息用户id
     */
    @TableField("receive_user_id")
    private Long receiveUserId;

    /**
     * 发送消息内容
     */
    @TableField("content")
    private String content;

    /**
     * 消息类型 1普通消息 2@消息 3系统消息
     */
    @TableField("type")
    private Integer type;


    /**
     * 需要跳转的内容url
     */
    @TableField("content_url")
    private String contentUrl;


    /**
     * 接收消息用户是否已读该信息
     */
    @TableField("receive_user_read")
    @Null(message = "非法传入参数", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    private Boolean receiveUserRead;

    @TableField("deleted")
    @TableLogic
    @Null(message = "非法传入参数", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    @JsonIgnore
    private Boolean deleted;

    @TableField(value = "insert_time", fill = FieldFill.INSERT)
    @ApiModelProperty(hidden = true)
    @Null(message = "非法传入参数", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    private LocalDateTime insertTime;

    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(hidden = true)
    @Null(message = "非法传入参数", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    private LocalDateTime updateTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    public Long getSendUserId() {
        return sendUserId;
    }

    public void setSendUserId(Long sendUserId) {
        this.sendUserId = sendUserId;
    }
    public Long getReceiveUserId() {
        return receiveUserId;
    }

    public void setReceiveUserId(Long receiveUserId) {
        this.receiveUserId = receiveUserId;
    }
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Boolean getReceiveUserRead() {
        return receiveUserRead;
    }

    public void setReceiveUserRead(Boolean receiveUserRead) {
        this.receiveUserRead = receiveUserRead;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }
    public LocalDateTime getInsertTime() {
        return insertTime;
    }

    public void setInsertTime(LocalDateTime insertTime) {
        this.insertTime = insertTime;
    }
    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getContentUrl() {
        return contentUrl;
    }

    public void setContentUrl(String contentUrl) {
        this.contentUrl = contentUrl;
    }

    @Override
    public String toString() {
        return "UserMessage{" +
                "id=" + id +
                ", sendUserId=" + sendUserId +
                ", receiveUserId=" + receiveUserId +
                ", content='" + content + '\'' +
                ", type=" + type +
                ", contentUrl='" + contentUrl + '\'' +
                ", receiveUserRead=" + receiveUserRead +
                ", deleted=" + deleted +
                ", insertTime=" + insertTime +
                ", updateTime=" + updateTime +
                '}';
    }
}
